package file;

import java.io.File;
import java.io.IOException;

/**
 * 课堂练习
 */
public class Test {
    public static void main(String[] args) throws IOException {
//        create();
        delete();
    }
    //该方法可以在当前项目目录下新建10个文件，名字为test1.txt-test10.txt
    public static void create() throws IOException {
        for (int i = 1; i <= 10; i++) {
            String fileName = "test"+i+".txt";
            File file = new File(fileName);
            file.createNewFile();
        }
    }
    //将当前项目目录下的test1.txt-test10.txt删除
    public static void delete(){
        for (int i = 1; i <= 10; i++) {
            String fileName = "test"+i+".txt";
            File file = new File(fileName);
            file.delete();
        }
    }
}
